package com.hblack.manage.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hblack.common.bean.EasyUIResult;
import com.hblack.manage.mapper.ContentMapper;
import com.hblack.manage.pojo.Content;

@Service
public class ContentService extends BaseService<Content> {

	@Autowired
	private ContentMapper contentMapper;
	
	public EasyUIResult queryContentByCategoryId(Long categoryId, Integer pageNum,
			Integer pageSize) {
		
		PageHelper.startPage(pageNum, pageSize);
		
		List<Content> list = contentMapper.queryContentByCategoryId(categoryId);
		
		PageInfo<Content> pageInfo = new PageInfo<Content>(list);
		
		return new EasyUIResult(pageInfo.getTotal(), list);
	}

}
